﻿/**********************************************************************
 * @file   OperSEASubSystemAutoShellGen.h
 * @brief  SEA子系统自动生成板操作器
 * @author liuzhonghua (liuzhonghuaszch@163.com)
 * @date   2024-11-18
 *********************************************************************/
#ifndef _OperSEASubSystemAutoShellGen_H
#define _OperSEASubSystemAutoShellGen_H

#include "FITK_Kernel/FITKCore/FITKActionOperator.h"
#include "FITK_Kernel/FITKCore/FITKOperatorRepo.h"
#include "FITK_Kernel/FITKCore/FITKThreadTask.h"

namespace Acoustics
{
    class FITKAbstractSEAFace;
    class FITKAbstractSEASubSysShell;
}

namespace Interface
{
    class FITKAbstractElement;
    class FITKElementTri3;

}

namespace Core
{
    class FITKNode;
}

namespace AbaqusData
{
    class FITKAbaqusPart;
}

namespace ModelOper
{
    /**
     * @brief SEA子系统自动生成板操作器
     * @author liuzhonghua (liuzhonghuaszch@163.com)
     * @date   2024-10-23
     */
    class OperSEASubSystemAutoShellGen :public Core::FITKActionOperator
    {
        Q_OBJECT;
    public:
        /**
         * @brief Construct a new Operators Create SubSystem object
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2024-10-23
         */
        explicit OperSEASubSystemAutoShellGen() = default;
        /**
         * @brief Destroy the Operators Create SubSystem object
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2024-10-23
         */
        virtual ~OperSEASubSystemAutoShellGen() = default;
        /**
         * @brief 执行
         * @return true 成功
         * @return false 失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2024-10-23
         */
        virtual bool execGUI() override;
        /**
         * @brief 执行结果处理
         * @return true 成功
         * @return false 失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2024-10-23
         */
        virtual bool execProfession() override;

    };

    /**
     * @brief  自动生成板线程
     * @author liuzhonghua (liuzhonghuaszch@163.com)
     * @date   2024-11-18
     */
    class RecogShellThread :public Core::FITKThreadTask
    {
        Q_OBJECT;
    public:
        /**
         * @brief Construct a new FITKRecogShellThread object
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2024-10-23
         */
        explicit RecogShellThread(Core::FITKActionOperator* oper);
        /**
         * @brief Destroy the FITKRecogShellThread object
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2024-10-23
         */
        virtual ~RecogShellThread() = default;
        /**
         * @brief 执行函数
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2024-10-23
         */
        void run();

    protected:
        /**
         * @brief    自动生成板的操作
         * @return   QList<int>
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-11-13
         */
        QList<int> autoGenerateShellOper();
        /**
         * @brief    生成板
         * @param[i] plateElemIndexs 
         * @param[i] elementList 
         * @param[i] partData 
         * @return   QList<int>
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-12-19
         */
        QList<int> genShell(QList<QList<int>> plateElemIndexs, QList<Interface::FITKAbstractElement*> elementList, AbaqusData::FITKAbaqusPart* partData);
        /**
         * @brief    生成SEA面数据
         * @param[i] nodeList 
         * @param[i] elementData 
         * @param[i] plateData 
         * @return   Acoustics::FITKAbstractSEAFace *
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-12-20
         */
        Acoustics::FITKAbstractSEAFace* genSEAFace(QList<Core::FITKNode*> nodeList, QList<Interface::FITKElementTri3*> elementList, Acoustics::FITKAbstractSEASubSysShell* plateData);

    private:
        /**
         * @brief  操作器
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2024-11-22
         */
        Core::FITKActionOperator* _oper{};
    };

    // 按钮注册相关操作
    Register2FITKOperatorRepo(actionAutoGenerateShell, OperSEASubSystemAutoShellGen);
}

#endif